package site.zbox.tool.swing.xml.component;

import javax.swing.JComponent;
import javax.swing.JLabel;

import org.dom4j.Element;

import site.zbox.tool.lang.StringUtils;
import site.zbox.tool.lang.Version;
import site.zbox.tool.swing.xml.IComponentParser;

@Version("2021.08.12")
public class LabelComponentParser implements IComponentParser {
    @Override
    public String name() {
        return "Label";
    }

    @Override
    public JComponent parse(final Element element) {
        final JLabel label = new JLabel();
        label.setText(StringUtils.stripToEmpty(element.attributeValue("text")));
        return label;
    }
}
